import request from '@/utils/request'

export const addressPostService = (
{ receiverName,
  receiverPhone,
  province,
  city,
  district,
  detailAddress,
  isDefault
}) => {
  return request.post('/user/api/me/address', { receiverName, receiverPhone, province, city, district, detailAddress, isDefault });
}

export const addressDeleteService = (addressId) => {
  return request.delete(`/user/api/me/address/${addressId}`);
}

export const addressPutService = (
  addressId,
{ receiverName,
  receiverPhone,
  province,
  city,
  district,
  detailAddress,
  isDefault
}) => {
  return request.put(`/user/api/me/address/${addressId}`, { receiverName, receiverPhone, province, city, district, detailAddress, isDefault });
}

export const addressGetService = () => {
  return request.get('/user/api/me/address');
}

export const addressGetDefaultService = () => {
  return request.get('/user/api/me/address/default');
}